<?php

/**
 * 1-n阶乘
 * 
 */

 function sum(int $n){
  if($n==0||$n==1){
    return 1;
  }else{
    return $n*sum($n-1);
  }
 }
 function sum2(int $n){
  if($n==0||$n==1){
    return $n;
  }else{
    return $n+sum2($n-1);
  }
 }

 echo sum(10)."<br>";
 echo sum2(100)."<br>";